package com.hll.mybatis_plus.controller;

import com.hll.mybatis_plus.pojo.Person;
import com.hll.mybatis_plus.service.PersonService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 前端控制器
 *
 * @author 狂神说
 * @since 2021-07-01
 */
@RestController
@RequestMapping("/user")
public class PersonController {
  @Autowired PersonService personService;

  @ApiOperation("获得指定id的用户信息")
  @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  public Person queryById(@ApiParam("用户id") @PathVariable("id") long id) {
    Person person = new Person();
    person.setId(id);
    return personService.getById(person);
  }
}
